/*
-------------------------------------------------------------------
BIE is Copyright 2001-2004 Brunswick Corp.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/bie_license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------

*/
import java.io.PrintStream;
import java.net.URL;
import javax.xml.rpc.ParameterMode;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import org.w3c.dom.Node;

public class TestWSClient
{

    public TestWSClient()
    {
    }

    /**
     * runService fs http://localhost:5803/axis/Route.jws "This is a test message"
     * @param args
     * @throws Exception
     */
    public static void main(String args[]) throws Exception
    {                
        if (args.length != 4) {
            System.out.println("usage: java TestWSClient 'method' 'routeKey' 'url' 'message'");
            return;
        }
        
        String i1 = new String(args[1]);
        String i2 = new String(args[3]);
        Service service = new Service();
        Call call = (Call)service.createCall();
        call.setTargetEndpointAddress(new URL(args[2]));
        call.setOperationName(args[0]);
        call.addParameter("op1", XMLType.XSD_STRING, ParameterMode.IN);
        call.addParameter("op2", XMLType.XSD_STRING, ParameterMode.IN);
        call.setReturnType(XMLType.XSD_STRING);
        String ret = (String)call.invoke(new Object[] {i1, i2});
        System.out.println("result = " + ret);
    }
}